"use strict";

exports.__esModule = true;
exports.getCellMetas = getCellMetas;
require("core-js/modules/es.array.push.js");
require("core-js/modules/es.object.from-entries.js");
require("core-js/modules/esnext.iterator.constructor.js");
require("core-js/modules/esnext.iterator.filter.js");
var _number = require("../../helpers/number");
/**
 * Gets all cell metas from the provided range.
 *
 * @param {Core} hot The Handsontable instance.
 * @param {number} fromRow The starting row index.
 * @param {number} toRow The ending row index.
 * @param {number} fromColumn The starting column index.
 * @param {number} toColumn The ending column index.
 * @returns {Array} Returns an array of cell metas.
 */
function getCellMetas(hot, fromRow, toRow, fromColumn, toColumn) {
  const genericKeys = ['visualRow', 'visualCol', 'row', 'col', 'prop'];
  const genericKeysLength = genericKeys.length;
  const cellMetas = [];
  (0, _number.rangeEach)(fromColumn, toColumn, columnIndex => {
    (0, _number.rangeEach)(fromRow, toRow, rowIndex => {
      const cellMeta = hot.getCellMeta(rowIndex, columnIndex);
      if (Object.keys(cellMeta).length !== genericKeysLength) {
        const uniqueMeta = Object.fromEntries(Object.entries(cellMeta).filter(_ref => {
          let [key] = _ref;
          return genericKeys.includes(key) === false;
        }));
        cellMetas.push([cellMeta.visualRow, cellMeta.visualCol, uniqueMeta]);
      }
    });
  });
  return cellMetas;
}